﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DXApplication1.cls
{
    class ListGroupList:List<FriGroup>
    {
        public ListGroupList()
        {
            FriGroup group1 = new FriGroup();
            group1.Gorupname = "我的好友";
            List<Friends> listFri = new List<Friends>();
            for (int i = 0; i < 50; i++)
            {
                Friends fri = new Friends();
                fri.Name = "小明" + i;
                fri.Number = "3652458" + i;
                fri.Avatar = "Images/avatar"+i%2+".png";
                fri.Sign = "明月几时有，把酒问青天。";
                listFri.Add(fri);
            }
            group1.Myfriends = listFri;


            FriGroup group2 = new FriGroup();
            group2.Gorupname = "我的同学";
            List<Friends> listFri2 = new List<Friends>();
            for (int i = 0; i < 5; i++)
            {
                Friends fri = new Friends();
                fri.Name = "小王" + i;
                fri.Number = "3611118" + i;
                fri.Avatar = "Images/avatar" + i % 2 + ".png";
                fri.Sign="相见时难别亦难，东风无力百花残。";
                listFri2.Add(fri);
            }
            group2.Myfriends = listFri2;
            Add(group1);
            Add(group2);
        }
        public FriGroup this[string name]
        {
            get
            {
                foreach (FriGroup gr in this)
                {
                    if (gr.Gorupname == name)
                        return gr;
                }
                return null;
            }
        }
    }
}
